﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProductSystem.BLL.Common
{
    public class ReturnStatus
    {
        #region 内部属性
        private string m_Message;
        #endregion
        /// <summary>
        /// 构造函数
        /// </summary>
        public ReturnStatus()
        {
            ErrorMessage = string.Empty;
            m_Message = string.Empty;
            Url = string.Empty;
            Status = false;
        }
        /// <summary>
        /// 返回值
        /// </summary>
        public bool Status { get; set; }
        /// <summary>
        /// 错误代码
        /// </summary>
        public int ErrorCode { get; set; }
        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrorMessage { get; set; }
        /// <summary>
        /// 返回信息
        /// </summary>
        public string Message
        {
            get
            {
                if (string.IsNullOrWhiteSpace(m_Message))
                    return ErrorMessage;
                return m_Message;
            }
            set { m_Message = value; }
        }
        /// <summary>
        /// 返回Url
        /// </summary>
        public string Url { get; set; }

        public override string ToString()
        {
            return Status ? Message : string.Format("[{0}]{1}", ErrorCode, ErrorMessage);
        }
    }
}
